// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import {Service} from '@/request/Server.js'
import * as request from '@/request/request.js'
import * as mr from '@/request/reqManage.js'
import * as hr from '@/request/homeRequest.js'
import * as contentRequest from '@/request/contentRequest.js'
import animate from 'animate.css'
import "./mock/index.js"
import * as Echarts from 'echarts'
import '@/assets/css/hover.css'
import '@/assets/css/mycss.css'

// import 'animate.css';
import 'swiper/dist/css/swiper.min.css'
import 'swiper/dist/js/swiper.min'


Vue.use(animate)

let item = localStorage.getItem('user');

if (item != null) {
  //将登录的用户挂在到全局 使用this.$user调用
  Vue.prototype.$user = item
}
Vue.prototype.$echarts = Echarts
Vue.prototype.$axios = Service;
//个人信息 ,文章发布等请求
Vue.prototype.$request = request
//home的所有请求
Vue.prototype.$homeReq = hr
//管理系统的所有请求
Vue.prototype.$mr = mr
//个人信息 ,文章发布等请求
Vue.prototype.$contentReq = contentRequest

Vue.use(ElementUI)
Vue.config.productionTip = false

//第三方畅言
Vue.prototype.$loadScript = (url, callback) => {
  let script = document.createElement('script');
  if (script.readyState) {
    // IE浏览器
    script.onreadystatechange = function () {
      if (script.readyState === 'loaded' || script.readyState === 'complete') {
        script.onreadystatechange = null;
        callback();
      }
    }
  } else {
    // 其他浏览器
    script.onload = function () {
      callback();
    }
  }
  script.src = url;
  document.getElementsByTagName('head')[0].appendChild(script);
}

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
